package homework.jdbc.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Created by Administrator on 2017/9/13.
 */
public class JDBCUtils {
    private static Connection connection=null;
    public static Connection getConnection() {
        try{
            Class.forName("com.mysql.jdbc.Driver");
             connection= DriverManager.getConnection("jdbc:mysql://localhost:3307/jdbc","root","123456");
            return connection;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;

    }
    public static void close() {
        try {
            connection.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
